package com.amos.muexamclient.sys.controller;

import com.amos.bean.Result;
import com.amos.muexamclient.sys.service.SysDictTypeService;
import com.amos.muexamclient.sys.service.dto.SysDictTypeDTO;
import com.amos.muexamcore.core.BasePageController;
import com.amos.muexamcore.core.BasePageService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

/**
 * Copyright © 2018 五月工作室. All rights reserved.
 *
 * @Package com.amos.muexamclient.sys.controller
 * @ClassName SysDictTypeController
 * @Description TODO
 * @Author Amos
 * @Modifier
 * @Date 2020-03-24 14:34:19
 * @Version 1.0
 **/
@RestController
@RequestMapping(value = "/sys/dict-type")
public class SysDictTypeController extends BasePageController<SysDictTypeDTO> {
    @Autowired
    private SysDictTypeService sysDictTypeService;

    @Override
    public BasePageService<SysDictTypeDTO> getPageService() {
        return sysDictTypeService;
    }

    @GetMapping(value = "/validate-dict-type/{dictType}")
    public Result validateDictType(@PathVariable("dictType") String dictType, @RequestParam("id") String id) {
        this.sysDictTypeService.validateDictType(dictType, id);
        return Result.ok();
    }

    @GetMapping(value = "/optionselect")
    public Result optionselect() {
        return Result.success(this.sysDictTypeService.optionselect());
    }
}
